<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>01-this执行问题</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://static.web.sdo.com/chuanshi/common/react.development.js"></script>
    <script src="http://static.web.sdo.com/chuanshi/common/react-dom.development.js"></script>
    <script src="http://static.web.sdo.com/chuanshi/common/babel.min.js"></script>
</head>
<body>
    <div class="container">
        <div id="app"></div>
    </div>
</body>
</html>
<script type="text/babel">
    class App extends React.Component {
        constructor(props) {
            super(props)
            this.state = { num: 0 }
            this.incrementEvent = this.incrementEvent.bind(this);
        }
        incrementEvent() {
            this.setState({
                num: this.state.num + 1
            })
        }
        render() {
            return (
                <div className="rows" style={{ padding: '40px' }}>
                    <div className="alert alert-info">当前数值 {this.state.num}</div>
                    <div className='btn btn-primary' onClick={this.incrementEvent}>点击加1</div>
                </div>
            )
        }
    }
    ReactDOM.render(<App />, document.getElementById("app"))
</script>